@echo off 
setlocal enabledelayedexpansion

set PROTOC_PATH="protoc/win32/protoc340.exe"

rd /s /q java
rd /s /q pb

md java
md pb

set protoFiles
for /f "delims=" %%a in ('dir /b/a-d/oN *.proto') do (
	echo %%a
	echo %%~na
	set protoFiles=!protoFiles! %%a
	rem %PROTOC_PATH% --java_out="./java/" --descriptor_set_out=pb/%%~na.pb %%a
)
echo %protoFiles%

set OUTFILE="protocol.pb"
rem test -d ${OUTFILE} && rm -f ${OUTFILE}

%PROTOC_PATH% --descriptor_set_out=%OUTFILE% %protoFiles%

xcopy /s /e /y %OUTFILE% "../hope-client/client/src/protocol"


pause


